package com.luwak.controller;

import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.security.Principal;

/**
 * @author ChenXc
 * @version V1.0
 * @Date 2018/2/27  15:24
 * @Description TODO(一句话描述类作用)
 */
@Controller
public class UserController {

    @GetMapping("/user")
    public String user(@AuthenticationPrincipal Principal principal, Model model) {

        model.addAttribute("username", principal.getName());
        return "user/user";

    }
}
